package service

import (
	"context"

	stage "stage/hertz_gen/stage"
	. "stageRpc/client"
	stageRpcModel "stageRpc/kitex_gen/stage"

	"github.com/cloudwego/hertz/pkg/app"
	"github.com/jinzhu/copier"
)

type EditFloorService struct {
	RequestContext *app.RequestContext
	Context        context.Context
}

func NewEditFloorService(Context context.Context, RequestContext *app.RequestContext) *EditFloorService {
	return &EditFloorService{RequestContext: RequestContext, Context: Context}
}

func (h *EditFloorService) Run(req *stage.Floor) (resp *bool, err error) {
	var floor = new(stageRpcModel.Floor)
	err = copier.Copy(floor, req)
	if err != nil {
		return nil, err
	}
	r, err := StageClient.EditFloor(context.Background(), floor)
	resp = &r
	return
}
